package com.goldsyear.springdemo;

import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author airhead
 */
@RestController
@RequestMapping(value = "demo")
public class DemoController {
  @PostMapping(value = "hello")
  public String hello(@RequestParam(value = "welcome") String welcome, @RequestParam(value = "name") String name) {
    return welcome + " " + name;
  }

  @PostMapping(value = "hello2")
  public String hello2(@RequestBody Map<String, String> body) {
    return body.get("welcome") + " " + body.get("name");
  }

  @PostMapping(value = "hello3")
  public String hello2(@RequestParam(value = "welcome") String welcome, @RequestBody Map<String, String> body) {
    return welcome + " " + body.get("name");
  }
}
